package cn.wolfcode.shop.api.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


@Getter
@Setter
public class Product extends BaseDomain {
    private Date createdDate;

    private Date lastModifiedDate;

    private Integer version;

    private Catalog catalog;

    private Brand brand;

    private String name;

    private String keyword;

    private String code;

    private String image;

    private BigDecimal marketPrice;

    private BigDecimal basePrice;

    private Long mods;

    private String impressions;


    public String getJsonString(){
        Map<String,Object> map = new HashMap();
        map.put("id",id);
        map.put("code",code);
        map.put("name",name);
        map.put("catalogId",this.catalog.getId()==this.catalog.getId()?this.catalog.getId():"");
        map.put("brandId", this.brand.getId()==this.brand.getId()?this.brand.getId():"");
        map.put("marketPrice",marketPrice);
        map.put("basePrice",basePrice);
        return JSON.toJSONString(map);
    }

}